<template>
	<view>
		<view class="tab-list">
			<u-tabs :scrollable="false" lineColor="#287E34" activeStyle="#287E34" :list="tabList"
				@click="tabChange"></u-tabs>
		</view>
		<orderList :lists="lists" :isJifen="1" :orderType="5" :orderStatus="tabItem"></orderList>
	</view>
</template>

<script>
	import orderList from '@/components/order-list.vue'
	export default {
		components: {
			orderList
		},
		data() {
			return {
				tabItem: '待卖出',
				tabList: [{
						name: '待卖出',
					},
					{
						name: '待结算',
					},
					{
						name: '已卖出'
					}
				],
				lists:[]
			}
		},
		onLoad() {
			this.init();
		},
		methods: {
			//获取我的仓库列表
			init() {
				// 0=仓库中,1=已上架,2=结算中,3=已卖出
				this.$http('orders.getMyStashList', {
					status: this.tabItem == '待卖出' ? 1 : this.tabItem == '待结算' ? 2 : 3
				}, '获取中...').then(res => {
					if (res.code == 1) {
						console.log(res, 11)
						this.lists = res.data
					}
				})
			},
			tabChange(item) {
				this.tabItem = item.name
				this.init();
			}
		}
	}
</script>
<style lang="scss" scoped>
	page {
		background-color: #F6F7F9;
	}

	.tab-list {
		width: 750rpx;
		height: 94rpx;
		background: #FFFFFF;
	}
</style>